﻿@model Bordspil.Models.User

@if(Request.IsAuthenticated)
{
    <div id="logoutForm">
        <div id="logoutButton">
            @using (Html.BeginForm("LogOut", "Home", FormMethod.Post, new { id = "logoutB"}))
            {
                <input type="submit" value="Log Out" />
                //<a id="smu" href="javascript:document.getElementById('logoutB').submit()">Log off</a>
            }
        </div>
        <div id="nameAtLogout">@Html.Encode(User.Identity.Name) |</div>
    </div>
}
else
{
    using (Html.BeginForm("LogIn", "Home", FormMethod.Post, new { id = "loginForm"}))
    { 
        @Html.ValidationSummary(true, "Innskránning tókst ekki, Tékkaðu hvort þú slóst inn réttar upplýsingar");
        <div>
            <div id="loginButton">
                <input type="submit" value="Log In" />
            </div>

            <div id="PW">
                <p>Password</p>
                @Html.PasswordFor(x => x.password)
                @Html.ValidationMessageFor(x => x.password)
            </div>

            <div id="US">
                <p>Username</p>
                @Html.TextBoxFor(x => x.username)
                @Html.ValidationMessageFor(x => x.username)
            </div>
        </div>
    }
}